Skip to content

Fix pc 1.8 spawn_entity packet structure#1106

Merged
extremeheat merged 2 commits intomasterfrom
copilot/fix-spawn-object-packet
Oct 30, 2025
Merged

Fix pc 1.8 spawn_entity packet structure#1106
extremeheat merged 2 commits intomasterfrom
copilot/fix-spawn-object-packet

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 30, 2025

The spawn_entity packet for Minecraft 1.8 had incorrect field ordering and nesting. The intField was nested inside objectData with conditional velocity fields, but the Java implementation reads intField at the top level first, then conditionally reads velocity data.

Changes

  • data/pc/1.8/proto.yml: Moved intField to top level after yaw field. Changed objectData to be conditional on intField value (void if 0, else read velocityX/Y/Z as i16)
  • data/pc/1.8/protocol.json: Regenerated from updated YAML

Structure

Before:

objectData:      
   intField: i32
   velocityX: intField ? ...
   velocityY: intField ? ...
   velocityZ: intField ? ...

After:

intField: i32
objectData: intField ?
   if 0: void
   default:
      velocityX: i16
      velocityY: i16
      velocityZ: i16

Matches the Java source which reads the int field unconditionally, then checks if (intField > 0) before reading three shorts.

Original prompt

This section details on the original issue you should resolve

<issue_title>pc 1.8 spawn object packet is incorrect</issue_title>
<issue_description>Chunk size is 27 but only 21 was read ; partial packet : {"name":"spawn_entity","params":{"entityId":16,"type":2,"x":0,"y":0,"z":0,"pitch":0,"yaw":0,"objectData":{"intField":0}}}; buffer :0e1002000000000000000000000000000000000000000000000000

Should be

   packet_spawn_entity:   
      entityId: varint
      type: i8
      x: i32
      y: i32
      z: i32
      pitch: i8
      yaw: i8
      intField: i32
      objectData: intField ?
         if 0: void
         default:
            velocityX: i16
            velocityY: i64
            velocityZ: i16

Currently is

   packet_spawn_entity:   
      entityId: varint
      type: i8
      x: i32
      y: i32
      z: i32
      pitch: i8
      yaw: i8
      objectData:      
         intField: i32
         velocityX: intField ?
            if 0: void
            default: i16
         velocityY: intField ?
            if 0: void
            default: i16
         velocityZ: intField ?
            if 0: void
            default: i16

based on

   public void func_148837_a(PacketBuffer var1) throws IOException {
      this.field_149018_a = var1.func_150792_a();
      this.field_149019_j = var1.readByte();
      this.field_149016_b = var1.readInt();
      this.field_149017_c = var1.readInt();
      this.field_149014_d = var1.readInt();
      this.field_149021_h = var1.readByte();
      this.field_149022_i = var1.readByte();
      this.field_149020_k = var1.readInt();
      if (this.field_149020_k > 0) {
         this.field_149015_e = var1.readShort();
         this.field_149012_f = var1.readShort();
         this.field_149013_g = var1.readShort();
      }

   }

wiki https://minecraft.wiki/w/Protocol?oldid=2772100, src</issue_description>

<agent_instructions>Please check if this is still an issue and fix if it's still an issue</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: extremeheat <13713600+extremeheat@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix incorrect spawn object packet structure Fix pc 1.8 spawn_entity packet structure Oct 30, 2025
Copilot AI requested a review from extremeheat October 30, 2025 12:06
@extremeheat extremeheat marked this pull request as ready for review October 30, 2025 13:08
@extremeheat extremeheat merged commit 3f0dd2a into master Oct 30, 2025
8 checks passed
@extremeheat extremeheat deleted the copilot/fix-spawn-object-packet branch October 30, 2025 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pc 1.8 spawn object packet is incorrect

2 participants